/** * Calculates the sum of an array of numbers. * * @param numbers - An array of numbers to sum. * @returns The total sum of the numbers. Returns 0 for an empty array. */ export function sum(numbers: number[]): number { return numbers.reduce((total, current) => total + current, 0); }